/*******************************************************************************
 *  Copyright (c) 2017 Oliver Meili
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  and Eclipse Distribution License v1.0 which accompany this distribution.
 *   
 *  The Eclipse Public License is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *  The Eclipse Distribution License is available at
 *  http://www.eclipse.org/org/documents/edl-v10.php.
 *   
 *  Contributors:
 *  Oliver Meili <omi@ieee.org>
 *******************************************************************************/
package org.eclipse.vorto.codegen.ble.alpwise.templates

import org.eclipse.vorto.codegen.api.InvocationContext
import org.eclipse.vorto.codegen.ble.templates.BleGattTemplate
import org.eclipse.vorto.core.api.model.informationmodel.InformationModel

class AlpwiseImHeaderTemplate extends BleGattTemplate<InformationModel> {
	
	override getFileName(InformationModel model) {
		return "BleInfoModel.h";
	}
	
	override getPath(InformationModel model) {
		return rootPath;
	}
	
	override getContent(InformationModel model, InvocationContext context) {
'''
/* «model.name» generated by Vorto */

#ifndef __«model.name.toUpperCase»_H__
#define __«model.name.toUpperCase»_H__

#include "BleUtils.h"

«FOR fb : model.properties»
	«IF context.getMappedElement(fb.type, "source").hasAttribute("uuid")»
		#include "«fb.type.name»/«fb.type.name».h"
	«ENDIF»
«ENDFOR»

typedef struct _«model.name»_t
{
	«FOR fb : model.properties»
		«IF context.getMappedElement(fb.type, "source").hasAttribute("uuid")»
			const «fb.type.name»_t *«fb.name»;
    	«ENDIF»
	«ENDFOR»
} «model.name»_t;

extern const «model.name»_t BleInfoModel;

#endif /* __«model.name.toUpperCase»_H__ */
'''
	}
	
	
}
